home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: news.ifm.liu.se!liuida!news
- From: c92manen@und.ida.liu.se (Mans Engman)
- Subject: Re: 680X0 -> PPC translator?
- X-Nntp-Posting-Host: astmatix.ida.liu.se
- Message-ID: <4770.6673T831T125@und.ida.liu.se>
- Sender: news@ida.liu.se
- Organization: CIS Dept, Linkoping University, Sweden
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
- References: <31499F8E.26A9@netvision.net.il> <volker.0fw1@vb.franken.de><315800D7.1854@sapiens.com>
- <volker.0g32@vb.franken.de><315C198B.49C2@netvision.net.il>
- <volker.0g5w@vb.franken.de><1996Apr2.230841.8275@scala.scala.com>
- <31640B0C.23F5@netvision.net.il> <1586.6669T961T2657@und.ida.liu.se> <31695324.57C8@netvision.net.il>
- Date: Tue, 9 Apr 1996 12:51:02 GMT
-
-
- >Mans Engman wrote:
- >>
- >> Once you think a bit, it's easy to show (prove!) that static code<->data
- >> distinction can't be determined by an algorithm. It is what theorists call
- >> an "undecidable" problem. Granted, for a "real" computer with a finite
- >> amount of memory/indata it can be "solved" by brute-force search, but this
- >> is not a practical approach.
-
- >many problems aren't solvable with today's technology, but it doesn't mean
- >they're not solvable with other yet-to-devised methods, now do they??
-
- What do you mean? You think someone will come up with algorithms to solve
- problems *beyond* what a Turing machine can?
-
- >>
- >> Okay, let's go on:
- >>
- >> 1) Hilberts 10th problem is a well known, proven undecidable problem. The
- >> problem is determining whether an integer polynomial equation has a
- >> (integer) solution.
-
- >oh please, stick to the subject at hand and stop making irrelevant analogies.
-
- This isn't an "irrelevant analogy", it's a simple example (among *many*
- undecidable problems) used to construct a program for which you can't analyse
- the program flow statically.
-
- >> 2) Now imagine a program calculating some function on the indata x, y, ...
- >> and uses the result as a pc-relative address where we jump. This function,
- >> and the rest of the program can be constructed such that for all x, y, ...
- >> we jump to a legal piece of code. Between these code chunks we will of
- >> course put data to confuse anyone analysing the program! :)
-
- >you havn't really thought about the implementation of your hypothetic
- >scenario have you?! in order for what you said to work you must store the
- >offsets from the current locations in some array, and the inputs are used to
- >calculate the array entry that should be selected that's all.
-
- No, I didn't intend using an array.
- I can easily construct a function that will be within certain bounds,
- and will always be a multiple of, say, 42, and you'll not be able to
- know/prove that by using an algorithm. That's the whole point of the example;
- the function itself is very easy to calculate, but it is undecidable what the
- possible results will be.
-
- Even if you use an array, you'd have exactly the same problem trying to know
- which elements of the array are used as code pointers, and which of them are
- something completely different. Like pointers to data which looks like
- code, but isn't used as such (see below).
-
- >calculating the
- >correct number of bytes to skip from arbitrary inputs without using this
- >method is next to impossible and most practical applications don't use this
- >method.
-
- It's perhaps not practical to have this very-advanced-function(tm) to
- calculate jump-addresses, but it's legal and possible.
-
- >you can't confuse the analysing program because ALL code sequences
- >can be identified without a problem, every sequence of words that makes sense
- >as a code sequence must be executable code and therefore can be identified.
- >by 'makes sense' i mean that the code makes references to other parts of the
- >program and a sequence of code instructions is maintained, you simply have
- >to follow the logic of that section and see if it's interrupted by some data
- >word without a jump that would prevent such a thing from happening.
-
- What you or your analyser thinks "makes sense" as executable code is not
- neccessarily code that will be executed.
-
- For instance, if some
- section of my program is
-
- $7070
- $c1c1
- $4e75
-
- and I some of the words as data (nice bit masks), you have
- no right to interpret the sequence as
-
- moveq #112,d0
- muls d1,d0
- rts
-
- even though that would "make sense" as legal code.
-
- The best thing you can do about this is to have the both the original data
- and the translated part, in the final translated program.
- Then, you could determine, at *run-time*, how it is used.
-
- Or how about a compiler with "code chunks" that are actually used as data to
- generate the output? If your algorithm translates that code (which it should
- according to your algorithm), then it would magically be PPC compiler!?
- Granted, that would be a great accomplishment, so if you succeed with that,
- I'm impressed :)
-
- >you might
- >wanna defer the translation until you make sure this section is actually
- >being called from somewhere alse.
-
- Which you can't, for all cases, determine before run-time.
-
- >> i) try different combinations of inputs and simulate the program. Inputs
- >> include outside calls, memory reads (that may change anytime), or other
- >> undecidable functions. To be sure the algorithm would have to try *all* of
- >> them. Combinatorial-explosion-city?
-
- >not true, as the code makes a jump using the array i mentioned and therefore
- >i know the possible offsets that exist.
-
- True, whether you use an array (which you incorrectly assume) or not.
-
- >Avi Lev.
-
- /Mans (.sig being recompiled)
-
-